import Vuex from 'vuex'
import Vue from 'vue'
Vue.use(Vuex)

let store = new Vuex.Store({
    state: {
        userInfo: JSON.parse(localStorage.getItem("userInfo")) || {}
    },
    mutations: {
        setHeader(state, data) {
            state.userInfo = data;
        },
        getHeader(state) {
            return state.userInfo;
        },
        cleanHeader(state) {
            state.userInfo = '';
        },
    }
})

export default store